<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the database edition</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.oci-set-edition" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">oci_set_edition</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.2, PHP 7, PECL OCI8 &gt;= 1.4.0)</p><p class="refpurpose"><span class="refname">oci_set_edition</span> &mdash; <span class="dc-title">Sets the database edition</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.oci-set-edition-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>oci_set_edition</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$edition</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Sets the database &quot;edition&quot; of objects to be used by a subsequent
   connections.
  </p>
  <p class="para">
   Oracle Editions allow concurrent versions of applications to run
   using the same schema and object names.  This is useful for
   upgrading live systems.
  </p>
  <p class="para">
   Call <span class="function"><strong>oci_set_edition()</strong></span> before calling
   <span class="function"><a href="oci_connect.html" class="function">oci_connect()</a></span>, <span class="function"><a href="oci_pconnect.html" class="function">oci_pconnect()</a></span>
   or <span class="function"><a href="oci_new_connect.html" class="function">oci_new_connect()</a></span>.
  </p>
  <p class="para">
   If an edition is set that is not valid in the database, connection
   will fail even if <span class="function"><strong>oci_set_edition()</strong></span> returns success.
  </p>
  <p class="para">
   When using persistent connections, if a connection with the
   requested edition setting already exists, it is reused.  Otherwise,
   a different persistent connection is created
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.oci-set-edition-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">edition</code></dt>

     <dd>

      <p class="para">
       Oracle Database edition name previously created with the <acronym>SQL</acronym>
       &quot;<em>CREATE EDITION</em>&quot; command.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.oci-set-edition-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <strong>Oracle version requirement</strong><br />
   <p class="para">
    This function is available from Oracle 11<em class="emphasis">g</em>R2 onwards.
   </p>
  </p></blockquote>
  <div class="caution"><strong class="caution">Caution</strong>
   <h1 class="title">Persistent connections</h1>
   <p class="para">
    To avoid inconsistencies and unexpected errors, do not use ALTER
    SESSION SET EDITION to change the edition on persistent connections.
   </p>
  </div>
  <div class="caution"><strong class="caution">Caution</strong>
   <h1 class="title">DRCP Connection Pooling</h1>
   <p class="para">
    To avoid inconsistencies and unexpected errors when using editions
    and <a href="oci8.connection.html" class="link">DRCP</a> with Oracle
    11.2.0.1, keep a one-to-one correspondence between
    the <a href="oci8.configuration.html#ini.oci8.connection-class" class="link">oci8.connection_class</a>
    and the edition name used by applications.  Each pooled server of
    a given connection class should only be used with one edition.
    This restriction has been removed with Oracle 11.2.0.2.
   </p>
  </div>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.oci-set-edition-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.oci-set-edition-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2459">
    <p><strong>Example #1 Two scripts can use different versions of myfunc() at the same time</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;File&nbsp;1<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Version&nbsp;1&nbsp;of&nbsp;application\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">oci_set_edition</span><span style="color: #007700">(</span><span style="color: #DD0000">'ORA$BASE'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"begin&nbsp;:r&nbsp;:=&nbsp;myfunc();&nbsp;end;"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_bind_by_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">":r"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;result&nbsp;is&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>


<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;File&nbsp;2<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"Version&nbsp;2&nbsp;of&nbsp;application\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">oci_set_edition</span><span style="color: #007700">(</span><span style="color: #DD0000">'E1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"begin&nbsp;:r&nbsp;:=&nbsp;myfunc();&nbsp;end;"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_bind_by_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">":r"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;result&nbsp;is&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


</div></div></div></body></html>